package ink.metoo.gude.model

enum class ApiStatus(
    val code: Int,
    val message: String,
) {

    SUCCESS(0, "成功"),
    FAIL(1000, "失败"),

    U_2003(2003, "用户不存在"),
    U_2004(2004, "用户输入参数不符"),
    U_2005(2005, "用户验证码错误或失效"),
    U_2006(2006, "注册邮箱已存在"),
    U_2007(2007, "输入密码错误"),
    U_2008(2008, "输入的密码和旧密码一致"),
    U_2009(2009, "用户操作的资源已超出限制"),
    U_2010(2010, "账号已存在"),

    S_3001(3001, "验证码在冷却中"),


    F_4001(4001, "不支持上传该文件类型"),


    G_5001(5001, "游戏已开始"),
    G_5002(5002, "游戏已结束"),
    G_5003(5003, "游戏已满"),
    G_5004(5004, "游戏已关闭"),
    G_5005(5005, "未找到该游戏类型处理方式"),
    G_5006(5006, "房间不存在"),

    ;

    companion object {

        fun valueOf(code: Int): ApiStatus? = ApiStatus.entries.firstOrNull { it.code == code }

    }
}
